import os
import traceback

import loguru
from loguru import logger
logger.add("tmux_start.log")
logger.debug("-----------开始执行python脚本---------------")
try:
    # with open('1.txt', 'a+', encoding='utf-8') as f:
    #     f.write('1000')
    os.system("/usr/bin/tmux new-session -d -s snow")
    os.system("/usr/bin/tmux new-session -d -s scrapyd")
    os.system("/usr/bin/tmux new-session -d -s web")

    os.system("/usr/bin/tmux send-keys -t snow 'snowflake_start_server --address=127.0.0.1 --port=8910' ENTER")
    os.system("/usr/bin/tmux send-keys -t scrapyd 'scrapyd' ENTER")

    os.system("/usr/bin/tmux send-keys -t web 'scrapydweb' ENTER")
except:
    logger.error(traceback.format_exc())


